<html>
<head><meta charset="utf-8"><title>wasm32 intrinsics safety docs · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/wasm32.20intrinsics.20safety.20docs.html">wasm32 intrinsics safety docs</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246167348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/wasm32%20intrinsics%20safety%20docs/near/246167348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/wasm32.20intrinsics.20safety.20docs.html#246167348">(Jul 15 2021 at 23:08)</a>:</h4>
<p>While working on the release blog post, I noticed that at least some of the unsafe wasm32 intrinsics don't seem to have any "safety" documentation for what their requirements are. </p>
<p>I seem to vaguely recall that <span class="user-mention" data-user-id="116015">@Alex Crichton</span> mentioned somewhere during the introduction that those may not yet be well known so it's hard for us to represent them in the docs. It seems like a key feature of the docs though if we're going to encourage folks to use these APIs! In practice it's probably true that for the most part the preconditions aren't too interesting (e.g., "pointer is valid for reading"). On the other hand, I'm not sure if wasm32 requires the address to be aligned for reading 128-bit vectors or not.</p>



<a name="246167364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/wasm32%20intrinsics%20safety%20docs/near/246167364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/wasm32.20intrinsics.20safety.20docs.html#246167364">(Jul 15 2021 at 23:08)</a>:</h4>
<p>(One example: <a href="https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.v128_load.html">https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.v128_load.html</a>)</p>



<a name="246167479"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/wasm32%20intrinsics%20safety%20docs/near/246167479" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/wasm32.20intrinsics.20safety.20docs.html#246167479">(Jul 15 2021 at 23:10)</a>:</h4>
<p>Oh this is a good point! I'll make updates to the docs tomorrow about the safety conditions, but you're right in that it's basically "this is a valid pointer with alignment of 1", so there's nothing too special, still should doucment of course</p>



<a name="246167570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/wasm32%20intrinsics%20safety%20docs/near/246167570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/wasm32.20intrinsics.20safety.20docs.html#246167570">(Jul 15 2021 at 23:11)</a>:</h4>
<p>these live in stdarch, right? </p>
<p><span class="user-mention" data-user-id="116015">@Alex Crichton</span> if you could try and cherry-pick and arrange for an easy bump on the beta branch, that'd be good too -- these are shipping in 1.54 (in 2 weeks) so would be great to get the safety docs immediately out there. not the end of the world if they're just on nightly though!</p>



<a name="246167629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/wasm32%20intrinsics%20safety%20docs/near/246167629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/wasm32.20intrinsics.20safety.20docs.html#246167629">(Jul 15 2021 at 23:12)</a>:</h4>
<p>(bumping submodules in beta backports can be a bit of a hassle when dealing with the upstream repo otherwise)</p>



<a name="246167640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/wasm32%20intrinsics%20safety%20docs/near/246167640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/wasm32.20intrinsics.20safety.20docs.html#246167640">(Jul 15 2021 at 23:12)</a>:</h4>
<p>Indeed yeah they live in stdarch</p>



<a name="246167670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/wasm32%20intrinsics%20safety%20docs/near/246167670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/wasm32.20intrinsics.20safety.20docs.html#246167670">(Jul 15 2021 at 23:12)</a>:</h4>
<p>I don't think I have the rights still to make branches and stuff so for a backport someone else may have to help</p>



<a name="246167685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/wasm32%20intrinsics%20safety%20docs/near/246167685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/wasm32.20intrinsics.20safety.20docs.html#246167685">(Jul 15 2021 at 23:13)</a>:</h4>
<p>But personally I don't see any need to backport a doc update</p>



<a name="246234385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/wasm32%20intrinsics%20safety%20docs/near/246234385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alex Crichton <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/wasm32.20intrinsics.20safety.20docs.html#246234385">(Jul 16 2021 at 14:59)</a>:</h4>
<p>I've opened <a href="https://github.com/rust-lang/stdarch/pull/1184">https://github.com/rust-lang/stdarch/pull/1184</a> for this</p>



<a name="246252668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/wasm32%20intrinsics%20safety%20docs/near/246252668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanieu <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/wasm32.20intrinsics.20safety.20docs.html#246252668">(Jul 16 2021 at 17:20)</a>:</h4>
<p>Note that stdarch master doesn't compile yet because of a change in the location of the <code>asm!</code> macro.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>